﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;

namespace Web
{
    public partial class Admin : System.Web.UI.MasterPage
    {
        public string userName = "";
        public string userID = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserName"] != null)
            {
                userName = Session["UserName"].ToString();
                userID = Session["UserID"].ToString();
            }
            else
            {
                string rawurl = Request.RawUrl;
                int index = rawurl.LastIndexOf('/') == -1 ? 0 : rawurl.LastIndexOf('/');
                rawurl = rawurl.Substring(index);
                Response.Redirect("admin_login.aspx?rtn=" + rawurl);
            }
        }

        protected void btn_logout_Click(object sender, EventArgs e)
        {
            //int isSuccess = AdminInfoLogic.LogoutAdmin(userName);
            Session["UserName"] = null;
            Session["UserID"] = null;
            Response.Redirect("admin_login.aspx");
        }
    }
}
